home *** CD-ROM | disk | FTP | other *** search
/ Champak 138 / Volume 138 Aug 19 2011 - Damaged.iso / Games / hopes_babysitting_maze.swf / scripts / __Packages / Classes / bsmIcon.as < prev    next >
Text File  |  2011-08-19  |  2KB  |  66 lines

  1. class Classes.bsmIcon extends Classes.bsmEntity
  2. {
  3.    var DEF_VALUE = 200;
  4.    function bsmIcon(t_data, t_levelPath, t_frameNum)
  5.    {
  6.       super();
  7.       this.x = t_data.x;
  8.       this.y = t_data.y;
  9.       this.specialNum = t_data.special;
  10.       this.isSpecial = false;
  11.       this.frameNum = t_frameNum;
  12.       this.levelPath = t_levelPath;
  13.       this.isActive = true;
  14.       this.value = this.DEF_VALUE;
  15.       this.assetID = "icon_mc";
  16.    }
  17.    function spawn(t_path, t_depth)
  18.    {
  19.       super.spawn(t_path,t_depth);
  20.       this.mc.gotoAndStop(this.frameNum);
  21.       if(this.isSpecial)
  22.       {
  23.          this.mc.mcAnim.icon.gotoAndStop("special");
  24.       }
  25.    }
  26.    function pickup()
  27.    {
  28.       if(this.isSpecial)
  29.       {
  30.          this.levelPath.engine.playSound("pickupSP");
  31.       }
  32.       else
  33.       {
  34.          this.levelPath.engine.playSound("pickup");
  35.       }
  36.       this.mc.mcAnim.gotoAndPlay("pickup");
  37.       if(!this.isSpecial)
  38.       {
  39.          this.mc.mcAnim.bonus_mc.stop();
  40.       }
  41.       this.isActive = false;
  42.       this.isSpecial = false;
  43.    }
  44.    function decSpecial(t_el)
  45.    {
  46.       this.specialTimer -= t_el;
  47.       if(this.specialTimer < 0)
  48.       {
  49.          this.goNormal();
  50.       }
  51.    }
  52.    function goSpecial(t_timer)
  53.    {
  54.       this.mc.mcAnim.icon.gotoAndStop("special");
  55.       this.isSpecial = true;
  56.       this.value = this.DEF_VALUE * 2.5;
  57.       this.specialTimer = t_timer;
  58.    }
  59.    function goNormal()
  60.    {
  61.       this.isSpecial = false;
  62.       this.mc.mcAnim.icon.gotoAndStop(1);
  63.       this.value = this.DEF_VALUE;
  64.    }
  65. }
  66.